# -*- coding: utf-8 -*-

#!/usr/bin/python
import numpy as np
import math
import cv2


#读取图片并显示
image = cv2.imread("./1.jpg", cv2.IMREAD_ANYCOLOR)
cv2.imshow("window",image)

# 取图片信息
shape = image.shape
# 行数
row = shape[0]
# 列数
col = shape[1]


#设置种子点
seedX = 100
seedY = 100


# 取上侧
splitTop = image[0:seedY, 0:col].copy()
# 图像向上挪移
image[0:row-seedY,0:col] = image[seedY:row,0:col]
#补全下侧图像孔雀开屏
image[row-seedY:row,0:col] = splitTop

# 取左侧
splitLeft = image[0:row,0:seedX].copy()
# 图像向左挪移
image[0:row,0:col-seedX] = image[0:row,seedX:col]
# 补全右侧
image[0:row,col-seedX:col] = splitLeft

### 平滑处理
# 设定平滑算子
# kernel = np.ones((5,5),np.float32)/25

#设定平滑范围
scope = 20

#选取平滑区域
areaRow = image[row-seedY-scope:row-seedY+scope, 0:col].copy()
areaRow = cv2.blur(areaRow,(5,5))
areaRow = cv2.blur(areaRow,(5,5))
image[row-seedY-scope:row-seedY+scope, 0:col] = areaRow

areaCol = image[0:row, col-seedX-scope:col-seedX+scope].copy()
areaCol = cv2.blur(areaCol,(5,5))
areaCol = cv2.blur(areaCol,(5,5))
image[0:row, col-seedX-scope:col-seedX+scope] = areaCol


cv2.imshow("window2",image)
cv2.waitKey(0)
